<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../../../include/admincontent.jsp" %>
<div id="location">当前位置：首页 > 招聘实施 > 社会招聘 > 笔试管理</div>
<div id="Content">
    <div class="btnbar">
        <button type="button" class="list" id="bs_plan">笔试安排</button>
        <button type="button" class="import" id="bs_outplan">导出笔试安排</button>
        <button type="button" class="import" id="bs_outnum">导出准考证</button>
        <button type="button" class="import" id="bs_in">导入笔试成绩</button>
        <button type="button" class="list" id="bs_msg">发短信</button>
        <button type="button" class="list" id="dosz_tjgw" pid="${pid}" fid="${fid}" deptcode="${deptcode}">推荐其他岗位
        </button>
        <button type="button" class="card" id="publishresult" fid="${fid}" deptcode="${deptcode}">公布/屏蔽结果</button>
        <button type="button" class="list" id="do_nznext">进入下一步</button>
        <button type="button" class="back" onclick="javascript:history.go(-1);">返 回</button>
    </div>
    <!-- 笔试安排 -->
    <div id="planpanel" class="condition_cont">
        <form id="thisform1" method="post" action="/Do/BS/PlanAction?pid=${pid}&fid=${fid}&deptcode=${deptcode}">
            <table class="treeTable searchform">
                <thead>
                <tr>
                    <td width="90">选择考场:</td>
                    <td width="440">
                        <div><select name="room" datatype="*" nullmsg="请选择考场">${room}</select></div>
                    </td>
                    <td width="300" style="text-align:left">如果没有您要选择的考场，请先到 <a href="/Do/BS/room">考场管理</a> 中新增考场</td>
                    <td></td>
                </tr>
                <tr>
                    <td>选择参与的考试:</td>
                    <td>
                        <div><select name="exam" datatype="*" nullmsg="请选择考试"></select></div>
                    </td>
                    <td style="text-align:left">如果没有您要选择的考试，请先到 <a href="/Do/BS/exam">考试管理</a> 中新增考试</td>
                    <td></td>
                </tr>
                <tr>
                    <td>备注:</td>
                    <td>
                        <div><input type="text" name="remark"/></div>
                    </td>
                    <td style="text-align:left">用于准考证备注栏</td>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td colspan="3">
                        <button type="submit" class="op">保存笔试安排</button>
                    </td>
                </tr>
                </thead>
            </table>
            <div id="bsusers"></div>
        </form>
    </div>

    <!-- 笔试通知 -->
    <div id="msgpanel" class="condition_cont">
        <form id="thisform2" method="post" action="/Do/BS/MsgAction?pid=${pid}&fid=${fid}&deptcode=${deptcode}">
            <table class="treeTable searchform">
                <thead>
                <tr>
                    <td width="60">短信模版：</td>
                    <td width="500">
                        <div><select id="dxmb" datatype="*" nullmsg="短信模版不能为空！">${dxmb}</select></div>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td>短信内容：</td>
                    <td>
                        <div><textarea name="dxnr" datatype="*" nullmsg="短信内容不能为空！"></textarea></div>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <button type="submit" class="save">提 交</button>
                    </td>
                    <td></td>
                </tr>
                </thead>
            </table>
            <div id="msgusers"></div>
        </form>
    </div>


    <!-- 筛选条件 -->
    <div id="searchbox">
        <form id="sform">
            <input type="hidden" name="proid" value="${pid}"/>
            <input type="hidden" name="path" value="/${fid}/"/>
            <table class="treeTable searchform">
                <thead>
                <tr>
                    <td>简历编号:</td>
                    <td colspan="2">
                        <div><input type="text" name="code"/></div>
                    </td>
                    <td>招聘职位:</td>
                    <td colspan="3">
                        <div><select name="jname">
                            <option value="">不限</option>
                            ${jobs}</select></div>
                    </td>
                    <td>短信通知:</td>
                    <td colspan="3">
                        <div>
                            <select name="notice">
                                <option value="-1">全部</option>
                                <option value="0">已发通知</option>
                                <option value="1">未发通知</option>
                            </select>
                        </div>
                    </td>
                    <td>笔试结果:</td>
                    <td colspan="3">
                        <div>
                            <select name="bsresult">
                                <option value="">全部</option>
                                <option value="不通过">不通过</option>
                                <option value="通过">通过</option>
                            </select>
                        </div>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td>姓名:</td>
                    <td colspan="2">
                        <div><input type="text" name="name"/></div>
                    </td>
                    <td>毕业院校:</td>
                    <td colspan="3">
                        <div><input type="text" name="university"/></div>
                    </td>
                    <td>所学专业:</td>
                    <td colspan="3">
                        <div><input type="text" name="majorname"/></div>
                    </td>
                    <td>最高学历:</td>
                    <td colspan="3">
                        <div><select name="education">
                            <option value="">不限</option>
                            ${education}</select></div>
                    </td>
                    <td></td>
                </tr>
                <tr class="moretj">
                    <td>民族:</td>
                    <td colspan="2">
                        <div><select name="mzcode">
                            <option value="">不限</option>
                            ${minzu}</select></div>
                    </td>
                    <td>政治面貌:</td>
                    <td colspan="3">
                        <div><select name="zzmmcode">
                            <option value="">不限</option>
                            ${zzmm}</select></div>
                    </td>
                    <td>婚否:</td>
                    <td colspan="3">
                        <div><select name="mcode">
                            <option value="">不限</option>
                            ${hunfou}</select></div>
                    </td>
                    <td>职业资格证:</td>
                    <td>
                        <div><select name="qllevelpid" id="s_jndjp">
                            <option value="">不限</option>
                            ${jndj}</select></div>
                    </td>
                    <td>
                        <div><select name="qllevelcode" id="s_jndj">
                            <option value="">不限</option>
                        </select></div>
                    </td>
                    <td>
                        <div><select name="qllevelscode" id="s_jndjs">
                            <option value="">不限</option>
                        </select></div>
                    </td>
                    <td></td>
                </tr>
                <tr class="moretj">
                    <td width="80">专业技术职务:</td>
                    <td width="80">
                        <div><select name="posttype" id="s_postt">
                            <option value="">不限</option>
                            ${posttype}</select></div>
                    </td>
                    <td width="80">
                        <div><select name="postlevel" id="s_postl">
                            <option value="">不限</option>
                        </select></div>
                    </td>
                    <td width="70" style="text-align:right;">年龄:</td>
                    <td width="60">
                        <div><input type="text" name="agefrom"/></div>
                    </td>
                    <td width="16" style="text-align:center;">至</td>
                    <td width="60">
                        <div><input type="text" name="ageto"/></div>
                    </td>
                    <td width="60" style="text-align:right;">工作年限:</td>
                    <td width="50">
                        <div><input type="text" name="workyearfrom"/></div>
                    </td>
                    <td width="36" style="text-align:center;">至</td>
                    <td width="50">
                        <div><input type="text" name="workyearto"/></div>
                    </td>
                    <td width="70" style="text-align:right;">身高:</td>
                    <td width="55">
                        <div><input type="text" name="heightfrom"/></div>
                    </td>
                    <td width="105" style="text-align:center;">至</td>
                    <td width="80">
                        <div><input type="text" name="heightto"/></div>
                    </td>
                    <td></td>
                </tr>
                <tr class="moretj">
                    <td>身份证号:</td>
                    <td colspan="2">
                        <div><input type="text" name="cardno"/></div>
                    </td>
                    <td>户口所在地:</td>
                    <td colspan="3">
                        <div><input type="text" name="hukouaddress"/></div>
                    </td>
                    <td>现居住地:</td>
                    <td colspan="3">
                        <div><input type="text" name="nowaddress"/></div>
                    </td>
                    <td>是否放弃:</td>
                    <td colspan="3">
                        <div>
                            <select name="fqstate">
                                <option value="">全部</option>
                                <option value="未放弃" selected>未放弃</option>
                                <option value="已放弃">已放弃</option>
                            </select>
                        </div>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="15">
                        <button id="searchbtn" type="button" class="search"></button>
                    </td>
                    <td>
                        <button id="showhidebtn" type="button" class="moretjbtn0" onclick="moreparam()"
                                title="高级查询"></button>
                    </td>
                </tr>
                </thead>
            </table>
        </form>
    </div>

    <table class="treeTable" id="tablelist">
        <thead>
        <tr>
            <td width="20"><input type="checkbox" class="allcheckbox" title="选择全部/取消全选"/></td>
            <td width="60">简历编号</td>
            <td width="80">招聘职位</td>
            <td width="60">姓名</td>
            <td width="70">学历</td>
            <td width="70">联系方式</td>
            <td width="60">准考证号</td>
            <td width="40">座位号</td>
            <td>笔试安排</td>
            <td width="60">综合素质</td>
            <td width="60">个性测评</td>
            <td width="60">专业测评</td>
            <td width="60">本轮成绩</td>
            <td width="50">短信通知</td>
            <td width="50">公布结果</td>
            <td width="45"></td>
        </tr>
        </thead>
        <tbody id="result"></tbody>
    </table>
    <div id="page"></div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        getList();
        $('#searchbtn').click(function () {
            $('#bsusers').html('');
            $('#msgusers').html('');
            getList();
        });

        //笔试安排
        $('#bs_plan').click(function () {
            $('#planpanel').slideToggle(300);
            $(this).toggleClass('cur').blur().siblings().removeClass('cur');
            if (!$('#msgpanel').is(":hidden")) {
                $('#msgpanel').slideToggle(300);
            }
        });

        getMsg();
        getExam();
        $('select[name=room]').change(function () {
            getExam();
        });

        //全选当页
        $(document).delegate('.allcheckbox', 'click', function () {
            $(this).parent().parent().parent().next().find('input[type=checkbox]').each(function () {
                var ck = $(this);
                if (ck.is(":checked")) {
                    $('#bsusers').append('<input type="hidden" name="uid" value="' + $(this).val() + '"/>');
                    $('#msgusers').append('<input type="hidden" name="uid" value="' + $(this).val() + '"/>');
                } else {
                    $('#bsusers input').each(function () {
                        if ($(this).val() == ck.val())
                            $(this).remove();
                    });
                    $('#msgusers input').each(function () {
                        if ($(this).val() == ck.val())
                            $(this).remove();
                    });
                }
            });
        });
        //选择一条
        $(document).delegate('#tablelist tbody tr', 'click', function () {
            var ck = $(this).find('input[type=checkbox]');
            if (ck.is(":checked")) {
                $('#bsusers').append('<input type="hidden" name="uid" value="' + ck.val() + '"/>');
                $('#msgusers').append('<input type="hidden" name="uid" value="' + ck.val() + '"/>');
            } else {
                $('#bsusers input').each(function () {
                    if ($(this).val() == ck.val())
                        $(this).remove();
                });
                $('#msgusers input').each(function () {
                    if ($(this).val() == ck.val())
                        $(this).remove();
                });
            }
        });

        //导出笔试安排
        $('#bs_outplan').click(function () {
            var uid = '';
            $('#bsusers input').each(function () {
                uid += '&uid=' + $(this).val();
            });
            location = '/Do/BS/exportplan?pid=${pid}&fid=${fid}' + uid;
        });

        //导出准考证
        $('#bs_outnum').click(function () {
            var uid = '';
            $('#bsusers input').each(function () {
                uid += '&uid=' + $(this).val();
            });
            location = '/Do/BS/exportticket?pid=${pid}&fid=${fid}' + uid;
        });

        //导入成绩
        $('#bs_in').click(function () {
            openLayer('导入笔试成绩', '/Do/BS/import?pid=${pid}&fid=${fid}&deptcode=${deptcode}', '80%', '80%');
        });

        //笔试通知
        $('#bs_msg').click(function () {
            $('#msgpanel').slideToggle(300);
            $(this).toggleClass('cur').blur().siblings().removeClass('cur');
            if (!$('#planpanel').is(":hidden")) {
                $('#planpanel').slideToggle(300);
            }
        });
        $('#dxmb').change(function () {
            getMsg();
        });

        $('#do_nznext').click(function () {
            layer.confirm('只有笔试通过的人员才能进入下一步。<br>确定要执行吗？', {
                btn: ['是', '否']
            }, function () {
                layer.closeAll();
                SubmitAll('/Do/SZExam/NextAction?pid=${pid}&fid=${fid}&deptcode=${deptcode}', 'bsusers');
            }, function () {
                layer.closeAll();
            });
        });

    });

    function getExam() {
        var url = '/Do/BS/getrexams?id=' + $('select[name=room]').val();
        getAjax(url, null, function (data) {
            $('select[name=exam]').html(data);
        });
    }

    function getList() {
        $('#page').myPagination({
            cssStyle: "pagination",
            ajax: {
                on: true,
                url: '${path}/Do/SZExam/getusers?flowid=${fid}',
                param: $('#sform').serialize(),
                dataType: 'html',
                callback: function (data) {
                    $('#result').html(data);
                    $('#bsusers input').each(function () {
                        var tval = $(this).val();
                        $('#result tr').each(function () {
                            var cb = $(this).find('input[type=checkbox]');
                            if (cb.length > 0 && tval == cb.val()) {
                                cb.attr('checked', 'true');
                                if (!$(this).hasClass('checked')) {
                                    $(this).addClass('checked');
                                }
                            }
                        });
                    });
                }
            }
        });
    }

    function getMsg() {
        getAjax('/Do/BS/getMsg?code=' + $('#dxmb').val(), null, function (data) {
            $('textarea[name=dxnr]').val(data);
        });
    }
</script>
</body>
</html>